import re

pattern = '黑客|破解|反爬|原力|天行者'

s = '年轻的天行者，愿原力与你同在！千万堕入黑暗原力！'
new_s = re.sub(pattern, 'XXX', s)
print(new_s)            # 年轻的XXX，愿XXX与你同在！千万堕入黑暗XXX！

s2 = 'https://www.baidu.com/s?wd=ys&res_sst=1'
pattern2 = '[?|&]'
lst = re.split(pattern2, s2)
print(lst)              # ['https://www.baidu.com/s', 'wd=ys', 'res_sst=1']








